package api

import (
	"day10/api/handler"
	"day10/consts"
	"github.com/gin-gonic/gin"
	jwt2 "github.com/golangblogs/gojwt"
)

func LoadRoutes(r *gin.Engine) {
	api := r.Group("/api")
	{
		user := api.Group("/user")
		{
			user.POST("/createUser", handler.CreateUser) //用户注册
			user.POST("/loginUser", handler.LoginUser)   // 用户登录
		}
		chat := api.Group("/chat")
		{
			chat.Use(jwt2.JWTAuth(consts.JWT_SELECT_KEY))
			chat.GET("/chat", handler.Chat)                 //聊天
			chat.POST("/createdGroup", handler.CreateGroup) //创建聊天室
			chat.POST("/recruitUser", handler.RecruitUser)  //用户进入聊天室

		}
	}
}
